#include "LoadingState.h"
#include "Overseer.h"
#include "GUIManager.h"
#include <iostream>

LoadingState::LoadingState(Overseer *o) : State(o)
{
	name = "Loading";
}

void LoadingState::initialise()
{
	overseer->getGUIManager()->executeScript("loadingScreen.lua");
	//spawn loader thread
	Ogre::ResourceGroupManager::getSingletonPtr()->initialiseAllResourceGroups();
}

void LoadingState::pause()
{
}

void LoadingState::resume()
{
}

void LoadingState::update(Ogre::Real timeSinceLastFrame)
{
	//should only need to trigger CEGUI events for the lua loader scripts to handle
	std::cout << "oh man" << std::endl;
}

void LoadingState::exit()
{
}

bool LoadingState::keyPressed(const OIS::KeyEvent &evt)
{
	if (evt.key==OIS::KC_ESCAPE) overseer->exit();
	return true;
}
bool LoadingState::keyReleased(const OIS::KeyEvent &evt)
{
	return true;
}
bool LoadingState::mouseMoved(const OIS::MouseEvent &evt)
{
	return true;
}
bool LoadingState::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID id)
{
	return true;
}
bool LoadingState::mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID id)
{
	return true;
}